<template>
    <div id="OrdersTitle">

        <v-table
                :searchFlag="false"
                :hasEdit="false"
                :page="page"
                :pageSize="pageSize"
                :tableConfig="tableConfig"
                :tableData="tableData"
                :total="total"
                @findData="getTableData"
                @getTableData="getTableData"
                @searhData="setSearhData"
                @selectData="setSelectData"
                @upData="getTableData"
                ref="table"
        ></v-table>
    </div>
</template>

<script>
    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";
    import table from "commons/Table";

    export default {
        props: {
            inputData: {
                type: Object,
            }
        },
        mixins: [baseMixin],
        name: "OrdersTitle",
        data() {
            return {
                tableConfig: [
                    {
                        label: this.$t('out.orderkey'),
                        prop: "orderkey",
                        input: "input",
                    },
                    {
                        label: this.$t('wave.totaleaches'),
                        prop: "totaleaches",
                        input: "input",
                    },
                    {
                        label: this.$t('out.boxnumber'),
                        prop: "totalcases",
                        input: "input",
                    },
                    {
                        label: this.$t('outbound.method4'),
                        prop: "totalpallets",
                        input: "input",
                    },
                    {
                        label: this.$t('config.volume'),
                        prop: "totalcube",
                        input: "input",
                    },
                    {
                        label: this.$t('config.suttle'),
                        prop: "totalnetweight",
                        input: "input",
                    },
                    {
                        label: this.$t('config.gross'),
                        prop: "totalgrossweight",
                        input: "input",
                    }
                ],
                tableData: [],
              page: 1,
                pageSize: 10,
                total: 10,
                searhData: {}
            }
        },
        computed: {
        },
        methods: {
            //获取table数据
            async getTableData(page, data) {
                try {
                    let res = await this.$api.get(`/queryWpShipmentorderListByWavekey/${this.inputData.wavekey}/${page}`);
                    
                        this.loading = false;
                        this.tableData = res.page.list;
                      this.page = res.page.curpage;
                        this.pageSize = res.page.pageSize;
                        this.total = res.page.total;
                    
                } catch (e) {
                    this.$message.error(e);
                }
            },
            //搜索值
            setSearhData(data, up) {
                if (!up) {
                    this.searhData = data;
                } else {
                    this.searhData = data;
                    this.getTableData(1, this.searhData);
                }
            },
            //选中的数据
            setSelectData(data) {
                this.$parent.setSelectData(data)
            },
        },
        mounted() {
            this.getTableData(1, {})
        },
        watch: {},
        components: {
            'v-details': details,
            'v-table': table
        }
    }
</script>

<style scoped>

</style>
